//
//  Match.m
//  YouthOlympic2014
//
//  Created by Li Yuhang on 14-7-1.
//  Copyright (c) 2014年 mitian. All rights reserved.
//

#import "GameEvent.h"

@implementation GameEvent
@synthesize id,begintime,endtime,title,place,picTag,stared;

-(NSString*) timeDescription{
    return [NSString stringWithFormat: @"%@ - %@", begintime, endtime];
}

-(UIImage*) icon{
    return [UIImage imageNamed:self.picTag];
}

+ (GameEvent*) instance: (NSDictionary*) jsonData{
    GameEvent* event = [[GameEvent alloc] init];
    //
    event.id = jsonData[@"id"];
    event.title = jsonData[@"title"];
    event.begintime = jsonData[@"time"];
    event.place = jsonData[@"place"];
    event.picTag = jsonData[@"pic"];
    event.stared = [jsonData[@"stared"] boolValue];
    //
    return event;
}

-(NSString *)description{
    return [NSString stringWithFormat: @"{id:%@, title:%@, begintime:%@, place:%@}", self.id, self.title, self.begintime, self.place];
}




@end
